package com.suemi.missile.common.mql.parse;

import com.suemi.missile.common.mql.exception.MqlParseException;
import org.antlr.v4.runtime.BaseErrorListener;
import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.Recognizer;

/**
 * @author suemi
 */
public class ParseErrorListener extends BaseErrorListener {
  public static final ParseErrorListener instance = new ParseErrorListener();

  @Override
  public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) {
    throw new MqlParseException("line " + line + ":" + charPositionInLine + " " + msg);
  }
}
